<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
    <span aria-hidden="true">&times;</span></button>
    <h5 class="modal-title">分配角色</h5>
</div>
<div class="modal-body">
	<div class="rows">
       	<div class="col-sm-12" style="text-align:left;">
       		<input type="hidden" id="groupId" name="groupId" value="${groupId}" />
			<select id="listbox_role" multiple="multiple">
			<!--:if(!isEmpty(allocRole)){  
				 for(role in allocRole){
				 if(isEmpty(role.selected)){
			-->
				<option value="${role.val}" >${role.name}</option>
			<!--:} else {  -->
				<option value="${role.val}" selected="selected" >${role.name}</option>
			<!--:}}} -->
			</select>
			<br/>
		</div>
	</div>
</div>
<div class="modal-footer clearfixed">
	<div class="rows">
		<div class="col-xs-12">
		    <button type="button" class="btn btn-info btn-xs no-border" id="saveRole">保存</button>
		    <button type="button" class="btn btn-info btn-xs no-border" data-dismiss="modal" aria-label="Close">关闭</button>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	var listRole = $('#listbox_role').bootstrapDualListbox({
		nonSelectedListLabel: '未分配列表',
		selectedListLabel: '已分配列表',
		filterTextClear: '<i class="ace-icon fa fa-refresh"></i>',
		selectorMinimalHeight: 280,
    	moveOnSelect: false,
    	
    	showFilterInputs: true,//屏蔽过滤文本框
    	infoText: false, //显示未选中数量文本信息
    	infoTextEmpty: false, // 显示已选中数量文本信息
    	infoTextFiltered: false, // 显示过滤后文本信息
    	
    	moveSelectedLabel: '增加选中角色',
    	moveAllLabel: '增加所有角色',
    	removeSelectedLabel: '移除选中角色',
    	removeAllLabel: '移除所有角色'
	});
	
	$('#saveRole').click(function(){
		var params = {};
		var groupId = $('#groupId').val();
		params['groupId'] = groupId;
		var roleIds = $(listRole).val();
		if(roleIds !== null){
			params['allocRoleIds'] = roleIds.toString();
		}
		$.ajax({
			type : "POST",
			url : "system/admin/group/doAllocRole",
			data : params,
			success : function(data) {
				if (data.status == "OK") {
					hideModal();
					TipMsg.success(data.message, 0);
				} else {
					TipMsg.error(data.message, 0);
				}
			}
		});
	});
});
</script>